package org.jeecg.modules.screen.utils;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class DateUtil {




    /**
     * 获取过去第几天的日期
     *
     * @param past
     * @return
     */
    public static String getPastDate(int past,String patten) {
        Calendar calendar = Calendar.getInstance();
        calendar.set(Calendar.DAY_OF_YEAR, calendar.get(Calendar.DAY_OF_YEAR) - past);
        Date today = calendar.getTime();
        SimpleDateFormat format = new SimpleDateFormat(patten);
        String result = format.format(today);
        return result;
    }
////
//    public static void main(String[] args) {
//        System.out.println(getPastDate(7,"yyyy-MM-dd hh:mm:ss"));
//    }
}
